/*
    HTTP COMMON DATA TYPES
    #kevx@09/19/2011
*/

#define STATUS_OK 200
#define STATUS_NOT_FOUND 404

#define delimiters          "\r\n"
#define RESP_STATUS         "HTTP/1.1 %d %s\r\n"
#define RESP_DATE           "Date: %s\r\n"
#define RESP_SERVER         "Server: MicroWebServer\r\n"
#define RESP_CONTENT_TYPE   "Content-Type: %s;\r\n"
#define RESP_CONTENT_LANG   "Content-Language: zh_CN\r\n"
#define RESP_HEADER_END     "\r\n\r\n"

#define RESP_RESULT_OK      "OK"
#define RESP_RESULT_404     "Not Found"

#define REQ_METHOD_GET      "GET"
#define REQ_METHOD_PST      "POST"

#define REQ_MAX_METHOD    10
#define REQ_MAX_URI       900
#define REQ_MAX_VER       10
#define REQ_MAX_HOST      50
#define REQ_MAX_EXT       10
#define REQ_MAX_BUF       REQ_MAX_URI

#define RESP_MAX_CT       50
#define RESP_MAX_DATE     50

#define SPACE " "
#define ZERO_BUF(buf,sz) memset(buf, 0, sizeof(char)*sz)

#define STATIC_RES_COUNT    6

typedef struct {
    char method[REQ_MAX_METHOD];
    char uri[REQ_MAX_URI];
    char ver[REQ_MAX_VER];
    char host[REQ_MAX_HOST];
    char ext[REQ_MAX_EXT];
}HttpReq;

typedef struct {
    int     status;
    char    result[50];
    char    date[RESP_MAX_DATE];
    char    contentType[RESP_MAX_CT];
    char    contentLanguage[20];
    char*   body;
    size_t  bodySize;
}HttpResp;

typedef struct {
    char ext[5];
    char ct[RESP_MAX_CT];
}StaticRes;

extern StaticRes _$staticRes[];
